function red() {
  console.log("red")
}
function green() {
  console.log("green")
}
function yellow() {
  console.log("yellow")
}
function light(fn, time) {
  return new Promise((resolve) => {
    setTimeout(() => {
      fn()
      resolve()
    }, time)
  })
}
async function run() {
  await light(red, 1000)
  await light(green, 1000)
  await light(yellow, 1000)
  run()
}
run()
